<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="./js/vue.js"></script>
    <style>
        .p-enter,
        .p-leave-to {
            opacity: 0;
        }

        .p-enter-to,
        .p-leave {
            opacity: 1;
        }

        .p-enter-active,
        .p-leave-active {
            transition: opacity 5s;
        }
    </style>
</head>

<body>
    <div id="app">
        <button @click="show=!show">切换</button>

        <!-- p -->
        <transition name="p">
            <p v-show="show">这是一个段落</p>
        </transition>

        <!-- v- -->
        <transition>
            <h2 v-show="show">这是一个段落</h2>
        </transition>

    </div>
    <script>
        let vm = new Vue({
            el: "#app",
            data: {
                show: false
            }
        })
    </script>
</body>

<html>